<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html >
<head>
	<meta name="decorator" content="sysDefault" content="text/html; charset=utf-8"/>
	<script src="${staticPath}/js/pospay/opendialog.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#key").focus();
			$("#dataForm").validate({
				submitHandler: function(form){
					Oosp_Loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			/*开始时间*/
			var startDate = "<c:out value="${couponTypeD.startDate}"/>";
			if(startDate != null && startDate != ""){
				$("#startDate").attr("value","<fmt:formatDate value="${couponTypeD.startDate}" pattern="yyyy-MM-dd HH:mm:ss" />");
			}else{
				$("#startDate").attr("value","");
			}
			
			/*结束时间*/
			var endDate = "<c:out value="${couponTypeD.endDate}"/>";
			if(endDate != null && endDate != ""){
				$("#endDate").attr("value","<fmt:formatDate value="${couponTypeD.endDate}" pattern="yyyy-MM-dd HH:mm:ss" />");
			}else{
				$("#endDate").attr("value","");
			}
		});
		
		$(function() {
			opendialog("${contextPath}/pospay/shop/list", "shopId");
		})
		$(function() {
			opendialog("${contextPath}/pospay/couponType/list", "couponTypeId");
		})
		$(function() {
			opendialog("${contextPath}/pospay/range/list", "rangeId");
		})
	</script>
</head>
<body>
	<div class="container-fluid">
		<div class="row">
			<div class="col-xs-12">
				<div class="panel panel-default">
				  <div class="panel-heading">
				    <h3 class="panel-title">编辑数据
						<a class="btn btn-default btn-sm pull-right" role="button" href="javascript:void(0)" onclick="history.go(-1)">返回</a>
				    </h3>
				  </div>
				  <div class="panel-body">
					<form:form id="dataForm" modelAttribute="couponTypeD" action="${contextPath}/pospay/couponTypeD/save" method="post" class="form-horizontal" role="form">
						<form:hidden path="id"/>
						<tags:message content="${message}"/>
								<div class="form-group">
									<label for="shopId" class="col-sm-2 control-label">分店ID:</label>
									<div class="col-sm-2">
										<form:input id="shopId" path="shopId" maxlength="20" class="form-control"/>
									</div>
								</div>
								<div class="form-group">
									<label for="couponTypeId" class="col-sm-2 control-label">券种ID:</label>
									<div class="col-sm-2">
										<form:input id="couponTypeId" path="couponTypeId" maxlength="20" class="form-control"/>
									</div>
								</div>
								<div class="form-group">
									<label for="rangeType" class="col-sm-2 control-label">范围类型:</label>
									<div class="col-sm-2">
										<form:input id="rangeType" path="rangeType" maxlength="20" class="form-control"/>
									</div>
								</div>
								<div class="form-group">
									<label for="rangeId" class="col-sm-2 control-label">范围ID:</label>
									<div class="col-sm-2">
										<form:input id="rangeId" path="rangeId" maxlength="20" class="form-control"/>
									</div>
								</div>
								<div class="form-group">
									<label for="rangeNo" class="col-sm-2 control-label">范围编码:</label>
									<div class="col-sm-2">
										<form:input id="rangeNo" path="rangeNo" maxlength="20" class="form-control"/>
									</div>
								</div>
								<div class="form-group">
									<label for="startDate" class="col-sm-2 control-label">开始日期:</label>
									<div class="col-sm-2">
										<div class="input-group date o-a-form-datetime" style="width:242px;" data-date="" data-date-format="yyyy-mm-dd hh:ii:ss">
											<form:input id="startDate" path="startDate" maxlength="20" class="form-control" />
											<span class="input-group-addon"><i class="glyphicon glyphicon-remove"></i></span>
											<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
										</div>
									</div>
								</div>
								<div class="form-group">
									<label for="endDate" class="col-sm-2 control-label">结束日期:</label>
									<div class="col-sm-2">
										<div class="input-group date o-a-form-datetime" style="width:242px;" data-date="" data-date-format="yyyy-mm-dd hh:ii:ss">
											<form:input id="endDate" path="endDate" maxlength="20" class="form-control" />
											<span class="input-group-addon"><i class="glyphicon glyphicon-remove"></i></span>
											<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
										</div>
									</div>
								</div>
						<div class="form-group">
						  <div class="col-sm-offset-2 col-sm-10">
						    <input class="btn btn-primary" type="submit" value="保 存"/>
							<input class="btn btn-default" type="button" value="返 回" onclick="history.go(-1)"/>
						  </div>
						</div>
					</form:form>
				  </div>
				</div>			
			</div>
		</div>
	</div>
	<script type="text/javascript">
		$(".o-a-form-datetime").datetimepicker({
	        language:  'zh-CN',
	        autoclose: true,
	        pickerPosition: "bottom-left"
	    });
	</script>
</body>
</html>